<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 
        Promise构造函数原型对象身上的方法
            -then   成功了以后
            -catch  失败以后
            -finally    不管成功还是失败
        */
        const p1=new Promise((resolve,reject)=>{
            try{
                throw new Error
                console.log('请求获取a数据')
                setTimeout(() => {
                    console.log('获取a数据')
                    resolve('ok')
                }, 2000);
            }catch(e){
                reject(e.message)
            }
        })
    </script>
</body>
</html>